@extends('layout.default')

@section('layout.content')

  <div class="row">    
    <div class="col-xs-12 align-right">
        <a href="{{route('question.create')}}" class="btn btn-lg btn-danger"><i class="ace-icon fa fa-bookmark"></i>新增题目</a>
    </div>
  </div><!-- /.row -->
  
  <div class="row">
    <div class="col-xs-12">
      <div class="tabbable">
        <ul class="nav nav-tabs" id="myTab">
          <li class="active">
            <a data-toggle="tab" href="#type0">
              儿童题型
            </a>
          </li>
          <li>
            <a data-toggle="tab" href="#type1">
              成人题型
            </a>
          </li>         
        </ul>

        <div class="tab-content">
          <div id="type0" class="tab-pane fade in active">
            <table class="table table-hover table-striped table-bordered nonborder">
              <thead>
              <tr>
                <th class="align-left">题目</th>
                <th class="center" style="width:70px;">选项数</th>
                <th class="center" style="width:90px;">创建时间</th>
              </tr>
              </thead>
              <tbody>          
                @foreach ($questions->where('type',0) as $i=>$question)             
                <tr class="bank">
                  <td class="align-left"><a href="{{route('question.edit',$question->id)}}">{{ $question->title }}</a></td>
                  <td class="center">{{ $question->options->count() }}</td>
                  <td class="center"><span class="grey smaller-80">{{ date('Y-m-d',strtotime($question->created_at)) }}</span></td>
                </tr>          
                @endforeach
              </tbody>
            </table>
          </div>

          <div id="type1" class="tab-pane fade">
            <table class="table table-hover table-striped table-bordered nonborder">
              <thead>
              <tr>
                <th class="align-left">题目</th>
                <th class="center" style="width:70px;">选项数</th>
                <th class="center" style="width:90px;">创建时间</th>
              </tr>
              </thead>
              <tbody>          
                @foreach ($questions->where('type',1) as $i=>$question)             
                <tr class="bank">
                  <td class="align-left"><a href="{{route('question.edit',$question->id)}}">{{ $question->title }}</a></td>
                  <td class="center">{{ $question->options->count() }}</td>
                  <td class="center"><span class="grey smaller-80">{{ date('Y-m-d',strtotime($question->created_at)) }}</span></td>
                </tr>          
                @endforeach
              </tbody>
            </table>
          </div>

        </div>
      </div>
    </div>
  </div>
  
@stop
@section('javascript')  
  <script type="text/javascript">
      $(function () {
          

      });
  </script>
@stop
